package cc.iotkit.manager.controller.adminMiniApp;

import cc.iotkit.common.api.Paging;
import cc.iotkit.common.api.Request;
import cc.iotkit.manager.dto.bo.order.OrderBo;
import cc.iotkit.manager.dto.vo.miniAdmin.MiniAdminOrderStatisRspVo;
import cc.iotkit.manager.dto.vo.miniAdmin.MiniAdminOrderVo;
import cc.iotkit.manager.service.IOrderService;
import cc.iotkit.model.system.SysOrder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cc.iotkit.common.api.PageRequest;

@Api(tags = {"后台管理订单统计"})
@Slf4j
@RestController
@RequestMapping("/miniAdmin/order")
public class MiniAdminOrderController {

    @Autowired
    private IOrderService orderService;

    @ApiOperation("订单列表")
    @PostMapping("/list")
    public Paging<SysOrder> list(@RequestBody PageRequest<MiniAdminOrderVo> orderBoRequest) throws Exception {
        return orderService.getPageList(orderBoRequest);
    }

    @ApiOperation("订单统计")
    @PostMapping("/orderStatis")
    public MiniAdminOrderStatisRspVo orderStatis(@RequestBody PageRequest<MiniAdminOrderVo> orderBoRequest) throws Exception {
        return orderService.getCountStatis(orderBoRequest);
    }

    @ApiOperation("订单详情")
    @PostMapping("/getDetail")
    public SysOrder getDetail(@RequestBody Request<Long> orderBoRequest) throws Exception {
        return orderService.getById(orderBoRequest);
    }
}
